from django import forms
from django.contrib.auth.forms import AuthenticationForm
from .models import Book


class BookForm(forms.ModelForm):
    class Meta:
        model = Book
        fields = ['title', 'author', 'description', 'price', 'cover_image']


class BookSearchForm(forms.Form):
    query = forms.CharField(max_length=100)


class CheckoutForm(forms.Form):
    name = forms.CharField(label='Name', max_length=100)
    email = forms.EmailField(label='Email')
    email_confirm = forms.EmailField(label='Confirm Email')


class LoginForm(AuthenticationForm):
    username = forms.CharField(widget=forms.TextInput(attrs={'placeholder': 'Username'}))
    password = forms.CharField(widget=forms.PasswordInput(attrs={'placeholder': 'Password'}))
